#pragma once

#include <vector>
#include "tcp_client_port.h"
#include "tcp_protocol_json.h"
#include "get_tcp_addr.h"
#include "interface_obj.h"

class InterfaceObj;

class TcpHandle
{
public:
    TcpHandle(InterfaceObj* in);
    ~TcpHandle();
    bool Open();
    void Close();
    void Reopen();
    void Start();
    void Stop();
    void SetAddrList(std::vector<IpAndPort> v) { mPushServerList = v; }
    void SetRecvCallBack(PackageDataCallBack cb, void* param);
    int PushRawData(const uint8_t* data, int len);
    int SendIdentify();
    bool IsOpen();
private:
    std::vector<IpAndPort> mPushServerList;
    TcpClientPort* mClient;
    TcpProtocolJson* mProtocol;
    InterfaceObj* mInterface;
};